home *** CD-ROM | disk | FTP | other *** search
/ PC PowerPlay 22 / PCPP #22.iso / Quake2 / q2source_12_11 / game / g_monster.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-29  |  16.5 KB  |  717 lines

  1. #include "g_local.h"
  2.  
  3.  
  4. //
  5. // monster weapons
  6. //
  7.  
  8. //FIXME mosnters should call these with a totally accurate direction
  9. // and we can mess it up based on skill.  Spread should be for normal
  10. // and we can tighten or loosen based on skill.  We could muck with
  11. // the damages too, but I'm not sure that's such a good idea.
  12. void monster_fire_bullet (edict_t *self, vec3_t start, vec3_t dir, int damage, int kick, int hspread, int vspread, int flashtype)
  13. {
  14.     fire_bullet (self, start, dir, damage, kick, hspread, vspread);
  15.  
  16.     gi.WriteByte (svc_muzzleflash2);
  17.     gi.WriteShort (self - g_edicts);
  18.     gi.WriteByte (flashtype);
  19.     gi.multicast (start, MULTICAST_PVS);
  20. }
  21.  
  22. void monster_fire_shotgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int hspread, int vspread, int count, int flashtype)
  23. {
  24.     fire_shotgun (self, start, aimdir, damage, kick, hspread, vspread, count);
  25.  
  26.     gi.WriteByte (svc_muzzleflash2);
  27.     gi.WriteShort (self - g_edicts);
  28.     gi.WriteByte (flashtype);
  29.     gi.multicast (start, MULTICAST_PVS);
  30. }
  31.  
  32. void monster_fire_blaster (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype, int effect)
  33. {
  34.     fire_blaster (self, start, dir, damage, speed, effect);
  35.  
  36.     gi.WriteByte (svc_muzzleflash2);
  37.     gi.WriteShort (self - g_edicts);
  38.     gi.WriteByte (flashtype);
  39.     gi.multicast (start, MULTICAST_PVS);
  40. }    
  41.  
  42. void monster_fire_grenade (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int flashtype)
  43. {
  44.     fire_grenade (self, start, aimdir, damage, speed, 2.5, damage+40);
  45.  
  46.     gi.WriteByte (svc_muzzleflash2);
  47.     gi.WriteShort (self - g_edicts);
  48.     gi.WriteByte (flashtype);
  49.     gi.multicast (start, MULTICAST_PVS);
  50. }
  51.  
  52. void monster_fire_rocket (edict_t *self, vec3_t start, vec3_t dir, int damage, int speed, int flashtype)
  53. {
  54.     fire_rocket (self, start, dir, damage, speed, damage+20, damage);
  55.  
  56.     gi.WriteByte (svc_muzzleflash2);
  57.     gi.WriteShort (self - g_edicts);
  58.     gi.WriteByte (flashtype);
  59.     gi.multicast (start, MULTICAST_PVS);
  60. }    
  61.  
  62. void monster_fire_railgun (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int kick, int flashtype)
  63. {
  64.     fire_rail (self, start, aimdir, damage, kick);
  65.  
  66.     gi.WriteByte (svc_muzzleflash2);
  67.     gi.WriteShort (self - g_edicts);
  68.     gi.WriteByte (flashtype);
  69.     gi.multicast (start, MULTICAST_PVS);
  70. }
  71.  
  72. void monster_fire_bfg (edict_t *self, vec3_t start, vec3_t aimdir, int damage, int speed, int kick, float damage_radius, int flashtype)
  73. {
  74.     fire_bfg (self, start, aimdir, damage, speed, damage_radius);
  75.  
  76.     gi.WriteByte (svc_muzzleflash2);
  77.     gi.WriteShort (self - g_edicts);
  78.     gi.WriteByte (flashtype);
  79.     gi.multicast (start, MULTICAST_PVS);
  80. }
  81.  
  82.  
  83.  
  84. //
  85. // Monster utility functions
  86. //
  87.  
  88. static void M_FliesOff (edict_t *self)
  89. {
  90.     self->s.effects &= ~EF_FLIES;
  91.     self->s.sound = 0;
  92. }
  93.  
  94. static void M_FliesOn (edict_t *self)
  95. {
  96.     self->s.effects |= EF_FLIES;
  97.     self->s.sound = gi.soundindex ("infantry/inflies1.wav");
  98.     self->think = M_FliesOff;
  99.     self->nextthink = level.time + 60;
  100. }
  101.  
  102. void M_FlyCheck (edict_t *self)
  103. {
  104.     if (self->waterlevel)
  105.         return;
  106.  
  107.     if (random() > 0.5)
  108.         return;
  109.  
  110.     self->think = M_FliesOn;
  111.     self->nextthink = level.time + 5 + 10 * random();
  112. }
  113.  
  114. void AttackFinished (edict_t *self, float time)
  115. {
  116.     self->monsterinfo.attack_finished = level.time + time;
  117. }
  118.  
  119.  
  120. void M_CheckGround (edict_t *ent)
  121. {
  122.     vec3_t        point;
  123.     trace_t        trace;
  124.  
  125.     if (ent->flags & (FL_SWIM|FL_FLY))
  126.         return;
  127.  
  128.     if (ent->velocity[2] > 100)
  129.     {
  130.         ent->groundentity = NULL;
  131.         return;
  132.     }
  133.  
  134. // if the hull point one-quarter unit down is solid the entity is on ground
  135.     point[0] = ent->s.origin[0];
  136.     point[1] = ent->s.origin[1];
  137.     point[2] = ent->s.origin[2] - 0.25;
  138.  
  139.     trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, point, ent, MASK_MONSTERSOLID);
  140.  
  141.     // check steepness
  142.     if ( trace.plane.normal[2] < 0.7 && !trace.startsolid)
  143.     {
  144.         ent->groundentity = NULL;
  145.         return;
  146.     }
  147.  
  148. //    ent->groundentity = trace.ent;
  149. //    ent->groundentity_linkcount = trace.ent->linkcount;
  150. //    if (!trace.startsolid && !trace.allsolid)
  151. //        VectorCopy (trace.endpos, ent->s.origin);
  152.     if (!trace.startsolid && !trace.allsolid)
  153.     {
  154.         VectorCopy (trace.endpos, ent->s.origin);
  155.         ent->groundentity = trace.ent;
  156.         ent->groundentity_linkcount = trace.ent->linkcount;
  157.         ent->velocity[2] = 0;
  158.     }
  159. }
  160.  
  161.  
  162. void M_CatagorizePosition (edict_t *ent)
  163. {
  164.     vec3_t        point;
  165.     int            cont;
  166.  
  167. //
  168. // get waterlevel
  169. //
  170.     point[0] = ent->s.origin[0];
  171.     point[1] = ent->s.origin[1];
  172.     point[2] = ent->s.origin[2] + ent->mins[2] + 1;    
  173.     cont = gi.pointcontents (point);
  174.  
  175.     if (!(cont & MASK_WATER))
  176.     {
  177.         ent->waterlevel = 0;
  178.         ent->watertype = 0;
  179.         return;
  180.     }
  181.  
  182.     ent->watertype = cont;
  183.     ent->waterlevel = 1;
  184.     point[2] += 26;
  185.     cont = gi.pointcontents (point);
  186.     if (!(cont & MASK_WATER))
  187.         return;
  188.  
  189.     ent->waterlevel = 2;
  190.     point[2] += 22;
  191.     cont = gi.pointcontents (point);
  192.     if (cont & MASK_WATER)
  193.         ent->waterlevel = 3;
  194. }
  195.  
  196.  
  197. void M_WorldEffects (edict_t *ent)
  198. {
  199.     int        dmg;
  200.  
  201.     if (ent->health > 0)
  202.     {
  203.         if (!(ent->flags & FL_SWIM))
  204.         {
  205.             if (ent->waterlevel < 3)
  206.             {
  207.                 ent->air_finished = level.time + 12;
  208.             }
  209.             else if (ent->air_finished < level.time)
  210.             {    // drown!
  211.                 if (ent->pain_debounce_time < level.time)
  212.                 {
  213.                     dmg = 2 + 2 * floor(level.time - ent->air_finished);
  214.                     if (dmg > 15)
  215.                         dmg = 15;
  216.                     T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR);
  217.                     ent->pain_debounce_time = level.time + 1;
  218.                 }
  219.             }
  220.         }
  221.         else
  222.         {
  223.             if (ent->waterlevel > 0)
  224.             {
  225.                 ent->air_finished = level.time + 9;
  226.             }
  227.             else if (ent->air_finished < level.time)
  228.             {    // suffocate!
  229.                 if (ent->pain_debounce_time < level.time)
  230.                 {
  231.                     dmg = 2 + 2 * floor(level.time - ent->air_finished);
  232.                     if (dmg > 15)
  233.                         dmg = 15;
  234.                     T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, dmg, 0, DAMAGE_NO_ARMOR);
  235.                     ent->pain_debounce_time = level.time + 1;
  236.                 }
  237.             }
  238.         }
  239.     }
  240.     
  241.     if (ent->waterlevel == 0)
  242.     {
  243.         if (ent->flags & FL_INWATER)
  244.         {    
  245.             gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_out.wav"), 1, ATTN_NORM, 0);
  246.             ent->flags &= ~FL_INWATER;
  247.         }
  248.         return;
  249.     }
  250.  
  251.     if ((ent->watertype & CONTENTS_LAVA) && !(ent->flags & FL_IMMUNE_LAVA))
  252.     {
  253.         if (ent->damage_debounce_time < level.time)
  254.         {
  255.             ent->damage_debounce_time = level.time + 0.2;
  256.             T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 10*ent->waterlevel, 0, 0);
  257.         }
  258.     }
  259.     if ((ent->watertype & CONTENTS_SLIME) && !(ent->flags & FL_IMMUNE_SLIME))
  260.     {
  261.         if (ent->damage_debounce_time < level.time)
  262.         {
  263.             ent->damage_debounce_time = level.time + 1;
  264.             T_Damage (ent, world, world, vec3_origin, ent->s.origin, vec3_origin, 4*ent->waterlevel, 0, 0);
  265.         }
  266.     }
  267.     
  268.     if ( !(ent->flags & FL_INWATER) )
  269.     {    
  270.         if (ent->watertype & CONTENTS_LAVA)
  271.             if (random() <= 0.5)
  272.                 gi.sound (ent, CHAN_BODY, gi.soundindex("player/lava1.wav"), 1, ATTN_NORM, 0);
  273.             else
  274.                 gi.sound (ent, CHAN_BODY, gi.soundindex("player/lava2.wav"), 1, ATTN_NORM, 0);
  275.         else if (ent->watertype & CONTENTS_SLIME)
  276.             gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
  277.         else if (ent->watertype & CONTENTS_WATER)
  278.             gi.sound (ent, CHAN_BODY, gi.soundindex("player/watr_in.wav"), 1, ATTN_NORM, 0);
  279.  
  280.         ent->flags |= FL_INWATER;
  281.         ent->damage_debounce_time = 0;
  282.     }
  283. }
  284.  
  285.  
  286. void M_droptofloor (edict_t *ent)
  287. {
  288.     vec3_t        end;
  289.     trace_t        trace;
  290.  
  291.     ent->s.origin[2] += 1;
  292.     VectorCopy (ent->s.origin, end);
  293.     end[2] -= 256;
  294.     
  295.     trace = gi.trace (ent->s.origin, ent->mins, ent->maxs, end, ent, MASK_MONSTERSOLID);
  296.  
  297.     if (trace.fraction == 1 || trace.allsolid)
  298.         return;
  299.  
  300.     VectorCopy (trace.endpos, ent->s.origin);
  301.  
  302.     gi.linkentity (ent);
  303.     M_CheckGround (ent);
  304.     M_CatagorizePosition (ent);
  305. }
  306.  
  307.  
  308. void M_SetEffects (edict_t *ent)
  309. {
  310.     ent->s.effects &= ~(EF_COLOR_SHELL|EF_POWERSCREEN);
  311.     ent->s.renderfx &= ~(RF_SHELL_RED|RF_SHELL_GREEN|RF_SHELL_BLUE);
  312.  
  313.     if (ent->monsterinfo.aiflags & AI_RESURRECTING)
  314.     {
  315.         ent->s.effects |= EF_COLOR_SHELL;
  316.         ent->s.renderfx |= RF_SHELL_RED;
  317.     }
  318.  
  319.     if (ent->health <= 0)
  320.         return;
  321.  
  322.     if (ent->powerarmor_time > level.time)
  323.     {
  324.         if (ent->monsterinfo.power_armor_type == POWER_ARMOR_SCREEN)
  325.         {
  326.             ent->s.effects |= EF_POWERSCREEN;
  327.         }
  328.         else if (ent->monsterinfo.power_armor_type == POWER_ARMOR_SHIELD)
  329.         {
  330.             ent->s.effects |= EF_COLOR_SHELL;
  331.             ent->s.renderfx |= RF_SHELL_GREEN;
  332.         }
  333.     }
  334. }
  335.  
  336.  
  337. void M_MoveFrame (edict_t *self)
  338. {
  339.     mmove_t    *move;
  340.     int        index;
  341.  
  342.     move = self->monsterinfo.currentmove;
  343.     self->nextthink = level.time + FRAMETIME;
  344.  
  345.     if ((self->monsterinfo.nextframe) && (self->monsterinfo.nextframe >= move->firstframe) && (self->monsterinfo.nextframe <= move->lastframe))
  346.     {
  347.         self->s.frame = self->monsterinfo.nextframe;
  348.         self->monsterinfo.nextframe = 0;
  349.     }
  350.     else
  351.     {
  352.         if (self->s.frame == move->lastframe)
  353.         {
  354.             if (move->endfunc)
  355.             {
  356.                 move->endfunc (self);
  357.  
  358.                 // regrab move, endfunc is very likely to change it
  359.                 move = self->monsterinfo.currentmove;
  360.  
  361.                 // check for death
  362.                 if (self->svflags & SVF_DEADMONSTER)
  363.                     return;
  364.             }
  365.         }
  366.  
  367.         if (self->s.frame < move->firstframe || self->s.frame > move->lastframe)
  368.         {
  369.             self->monsterinfo.aiflags &= ~AI_HOLD_FRAME;
  370.             self->s.frame = move->firstframe;
  371.         }
  372.         else
  373.         {
  374.             if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
  375.             {
  376.                 self->s.frame++;
  377.                 if (self->s.frame > move->lastframe)
  378.                     self->s.frame = move->firstframe;
  379.             }
  380.         }
  381.     }
  382.  
  383.     index = self->s.frame - move->firstframe;
  384.     if (move->frame[index].aifunc)
  385.         if (!(self->monsterinfo.aiflags & AI_HOLD_FRAME))
  386.             move->frame[index].aifunc (self, move->frame[index].dist * self->monsterinfo.scale);
  387.         else
  388.             move->frame[index].aifunc (self, 0);
  389.  
  390.     if (move->frame[index].thinkfunc)
  391.         move->frame[index].thinkfunc (self);
  392. }
  393.  
  394.  
  395. void monster_think (edict_t *self)
  396. {
  397.     M_MoveFrame (self);
  398.     if (self->linkcount != self->monsterinfo.linkcount)
  399.     {
  400.         self->monsterinfo.linkcount = self->linkcount;
  401.         M_CheckGround (self);
  402.     }
  403.     M_CatagorizePosition (self);
  404.     M_WorldEffects (self);
  405.     M_SetEffects (self);
  406. }
  407.  
  408.  
  409. /*
  410. ================
  411. monster_use
  412.  
  413. Using a monster makes it angry at the current activator
  414. ================
  415. */
  416. void monster_use (edict_t *self, edict_t *other, edict_t *activator)
  417. {
  418.     if (self->enemy)
  419.         return;
  420.     if (self->health <= 0)
  421.         return;
  422.     if (activator->flags & FL_NOTARGET)
  423.         return;
  424.     if (!(activator->client) && !(activator->monsterinfo.aiflags & AI_GOOD_GUY))
  425.         return;
  426.     
  427. // delay reaction so if the monster is teleported, its sound is still heard
  428.     self->enemy = activator;
  429.     FoundTarget (self);
  430. }
  431.  
  432.  
  433. void monster_start_go (edict_t *self);
  434.  
  435.  
  436. void monster_triggered_spawn (edict_t *self)
  437. {
  438.     self->s.origin[2] += 1;
  439.     KillBox (self);
  440.  
  441.     self->solid = SOLID_BBOX;
  442.     self->movetype = MOVETYPE_STEP;
  443.     self->svflags &= ~SVF_NOCLIENT;
  444.     self->air_finished = level.time + 12;
  445.     gi.linkentity (self);
  446.  
  447.     monster_start_go (self);
  448.  
  449.     if (self->enemy && !(self->spawnflags & 1) && !(self->enemy->flags & FL_NOTARGET))
  450.     {
  451.         FoundTarget (self);
  452.     }
  453.     else
  454.     {
  455.         self->enemy = NULL;
  456.     }
  457. }
  458.  
  459. void monster_triggered_spawn_use (edict_t *self, edict_t *other, edict_t *activator)
  460. {
  461.     // we have a one frame delay here so we don't telefrag the guy who activated us
  462.     self->think = monster_triggered_spawn;
  463.     self->nextthink = level.time + FRAMETIME;
  464.     if (activator->client)
  465.         self->enemy = activator;
  466.     self->use = monster_use;
  467. }
  468.  
  469. void monster_triggered_start (edict_t *self)
  470. {
  471.     self->solid = SOLID_NOT;
  472.     self->movetype = MOVETYPE_NONE;
  473.     self->svflags |= SVF_NOCLIENT;
  474.     self->nextthink = 0;
  475.     self->use = monster_triggered_spawn_use;
  476. }
  477.  
  478.  
  479. /*
  480. ================
  481. monster_death_use
  482.  
  483. When a monster dies, it fires all of its targets with the current
  484. enemy as activator.
  485. ================
  486. */
  487. void monster_death_use (edict_t *self)
  488. {
  489.     self->flags &= ~(FL_FLY|FL_SWIM);
  490.     self->monsterinfo.aiflags &= AI_GOOD_GUY;
  491.  
  492.     if (self->item)
  493.     {
  494.         Drop_Item (self, self->item);
  495.         self->item = NULL;
  496.     }
  497.  
  498.     if (self->deathtarget)
  499.         self->target = self->deathtarget;
  500.  
  501.     if (!self->target)
  502.         return;
  503.  
  504.     G_UseTargets (self, self->enemy);
  505. }
  506.  
  507.  
  508. //============================================================================
  509.  
  510. qboolean monster_start (edict_t *self)
  511. {
  512.     if (deathmatch->value || nomonsters->value)
  513.     {
  514.         G_FreeEdict (self);
  515.         return false;
  516.     }
  517.  
  518.     if ((self->spawnflags & 4) && !(self->monsterinfo.aiflags & AI_GOOD_GUY))
  519.     {
  520.         self->spawnflags &= ~4;
  521.         self->spawnflags |= 1;
  522. //        gi.dprintf("fixed spawnflags on %s at %s\n", self->classname, vtos(self->s.origin));
  523.     }
  524.  
  525.     if (!(self->monsterinfo.aiflags & AI_GOOD_GUY))
  526.         level.total_monsters++;
  527.  
  528.     self->nextthink = level.time + FRAMETIME;
  529.     self->svflags |= SVF_MONSTER;
  530.     self->s.renderfx |= RF_FRAMELERP;
  531.     self->takedamage = DAMAGE_AIM;
  532.     self->air_finished = level.time + 12;
  533.     self->use = monster_use;
  534.     self->max_health = self->health;
  535.     self->clipmask = MASK_MONSTERSOLID;
  536.  
  537.     self->s.skinnum = 0;
  538.     self->deadflag = DEAD_NO;
  539.     self->svflags &= ~SVF_DEADMONSTER;
  540.  
  541.     if (!self->monsterinfo.checkattack)
  542.         self->monsterinfo.checkattack = M_CheckAttack;
  543.     VectorCopy (self->s.origin, self->s.old_origin);
  544.  
  545.     if (st.item)
  546.     {
  547.         self->item = FindItemByClassname (st.item);
  548.         if (!self->item)
  549.             gi.dprintf("%s at %s has bad item: %s\n", self->classname, vtos(self->s.origin), st.item);
  550.     }
  551.  
  552.     // randomize what frame they start on
  553.     if (self->monsterinfo.currentmove)
  554.         self->s.frame = self->monsterinfo.currentmove->firstframe + (rand() % (self->monsterinfo.currentmove->lastframe - self->monsterinfo.currentmove->firstframe + 1));
  555.  
  556.     return true;
  557. }
  558.  
  559. void monster_start_go (edict_t *self)
  560. {
  561.     vec3_t    v;
  562.  
  563.     if (self->health <= 0)
  564.         return;
  565.  
  566.     // check for target to combat_point and change to combattarget
  567.     if (self->target)
  568.     {
  569.         qboolean    notcombat;
  570.         qboolean    fixup;
  571.         edict_t        *target;
  572.  
  573.         target = NULL;
  574.         notcombat = false;
  575.         fixup = false;
  576.         while ((target = G_Find (target, FOFS(targetname), self->target)) != NULL)
  577.         {
  578.             if (strcmp(target->classname, "point_combat") == 0)
  579.             {
  580.                 self->combattarget = self->target;
  581.                 fixup = true;
  582.             }
  583.             else
  584.             {
  585.                 notcombat = true;
  586.             }
  587.         }
  588.         if (notcombat && self->combattarget)
  589.             gi.dprintf("%s at %s has target with mixed types\n", self->classname, vtos(self->s.origin));
  590.         if (fixup)
  591.             self->target = NULL;
  592.     }
  593.  
  594.     // validate combattarget
  595.     if (self->combattarget)
  596.     {
  597.         edict_t        *target;
  598.  
  599.         target = NULL;
  600.         while ((target = G_Find (target, FOFS(targetname), self->combattarget)) != NULL)
  601.         {
  602.             if (strcmp(target->classname, "point_combat") != 0)
  603.             {
  604.                 gi.dprintf("%s at (%i %i %i) has a bad combattarget %s : %s at (%i %i %i)\n",
  605.                     self->classname, (int)self->s.origin[0], (int)self->s.origin[1], (int)self->s.origin[2],
  606.                     self->combattarget, target->classname, (int)target->s.origin[0], (int)target->s.origin[1],
  607.                     (int)target->s.origin[2]);
  608.             }
  609.         }
  610.     }
  611.  
  612.     if (self->target)
  613.     {
  614.         self->goalentity = self->movetarget = G_PickTarget(self->target);
  615.         if (!self->movetarget)
  616.         {
  617.             gi.dprintf ("%s can't find target %s at %s\n", self->classname, self->target, vtos(self->s.origin));
  618.             self->target = NULL;
  619.             self->monsterinfo.pausetime = 100000000;
  620.             self->monsterinfo.stand (self);
  621.         }
  622.         else if (strcmp (self->movetarget->classname, "path_corner") == 0)
  623.         {
  624.             VectorSubtract (self->goalentity->s.origin, self->s.origin, v);
  625.             self->ideal_yaw = self->s.angles[YAW] = vectoyaw(v);
  626.             self->monsterinfo.walk (self);
  627.             self->target = NULL;
  628.         }
  629.         else
  630.         {
  631.             self->goalentity = self->movetarget = NULL;
  632.             self->monsterinfo.pausetime = 100000000;
  633.             self->monsterinfo.stand (self);
  634.         }
  635.     }
  636.     else
  637.     {
  638.         self->monsterinfo.pausetime = 100000000;
  639.         self->monsterinfo.stand (self);
  640.     }
  641.  
  642.     self->think = monster_think;
  643.     self->nextthink = level.time + FRAMETIME;
  644. }
  645.  
  646.  
  647. void walkmonster_start_go (edict_t *self)
  648. {
  649.     if (!(self->spawnflags & 2) && level.time < 1)
  650.     {
  651.         M_droptofloor (self);
  652.  
  653.         if (self->groundentity)
  654.             if (!M_walkmove (self, 0, 0))
  655.                 gi.dprintf ("%s in solid at %s\n", self->classname, vtos(self->s.origin));
  656.     }
  657.     
  658.     if (!self->yaw_speed)
  659.         self->yaw_speed = 20;
  660.     self->viewheight = 25;
  661.  
  662.     monster_start_go (self);
  663.  
  664.     if (self->spawnflags & 2)
  665.         monster_triggered_start (self);
  666. }
  667.  
  668. void walkmonster_start (edict_t *self)
  669. {
  670.     self->think = walkmonster_start_go;
  671.     monster_start (self);
  672. }
  673.  
  674.  
  675. void flymonster_start_go (edict_t *self)
  676. {
  677.     if (!M_walkmove (self, 0, 0))
  678.         gi.dprintf ("%s in solid at %s\n", self->classname, vtos(self->s.origin));
  679.  
  680.     if (!self->yaw_speed)
  681.         self->yaw_speed = 10;
  682.     self->viewheight = 25;
  683.  
  684.     monster_start_go (self);
  685.  
  686.     if (self->spawnflags & 2)
  687.         monster_triggered_start (self);
  688. }
  689.  
  690.  
  691. void flymonster_start (edict_t *self)
  692. {
  693.     self->flags |= FL_FLY;
  694.     self->think = flymonster_start_go;
  695.     monster_start (self);
  696. }
  697.  
  698.  
  699. void swimmonster_start_go (edict_t *self)
  700. {
  701.     if (!self->yaw_speed)
  702.         self->yaw_speed = 10;
  703.     self->viewheight = 10;
  704.  
  705.     monster_start_go (self);
  706.  
  707.     if (self->spawnflags & 2)
  708.         monster_triggered_start (self);
  709. }
  710.  
  711. void swimmonster_start (edict_t *self)
  712. {
  713.     self->flags |= FL_SWIM;
  714.     self->think = swimmonster_start_go;
  715.     monster_start (self);
  716. }
  717.